.panel.panel-default
  .panel-heading
    .panel-title
      .html_title
        = @sales_firm.name
        - if @sales_firm.short_name.present?
          | (字号：#{ @sales_firm.short_name})
        - if @sales_firm.rating
          | (#{@sales_firm.rating_text})
        = link_to '天眼查', tianyan_link(@sales_firm.name), target: '_blank', class: 'btn btn-xs btn-info'
      .pull-right
        - if @sales_firm.leads.map(&:user_id).include?(current_user.id)
          = link_to_dialog '编辑', edit_sales_firm_path(@sales_firm), class: 'btn btn-sm btn-primary push-5-l'
        - else
          = link_to '获取', grab_sales_firm_path(@sales_firm), data: {confirm: '确定获取？', remote: true}, class: 'btn btn-sm btn-success push-5-l'
  .panel-body
    .row
      .col-md-6
        table.table.table-borderless.table-condensed
          tr
            td style='width: 120px'
              strong 省份城市：
            td= @sales_firm.province_city
          tr
            td
              strong 地址：
            td= @sales_firm.address
          tr
            td
              strong 官网：
            td= @sales_firm.website
          tr
            td
              strong 公司电话：
            td= @sales_firm.phone
          tr
            td
              strong 传真：
            td= @sales_firm.fax
          tr
            td
              strong 邮箱：
            td= @sales_firm.email
          tr
            td
              strong 备注：
            td= @sales_firm.notes

      .col-md-6
        strong Leads跟进信息
        hr
        - @sales_firm.leads.each do |l|
          .row
            .col-xs-12
              span.badge.badge-info= l.leads_type_text
              |&nbsp;-&nbsp;
              = l.user
              = "（#{l.begin_at.format_date(:date)}~#{l.expire_at.format_date(:date)}）"

    ==render partial: '/sales/firms/detail_info'
    ==render partial: '/sales/contacts/list_in_firm'
    ==render partial: '/sales/follow_ups/list_in_firm'
    ==render partial: '/sales/finance_infos/list_in_firm'
